<?php
include("../common.inc.php");
InitGP(array("page","action","bid","delids")); //初始化变量全局返回
include("function_common.php");
//初始化对象
include(INC_PATH."/groupbond.class.php");
$gb=new GroupBondClass();

if(empty($action)){
	InitGP(array("gid","sn","uid")); //初始化变量全局返回
	if(!empty($gid))$wherestr[]="gid='{$gid}'";
	if(!empty($sn))$wherestr[]="sn like '%{$sn}%'";
	if(!empty($uid))$wherestr[]="uid={$uid}";
	if(!empty($wherestr)) $wheresql = implode(' AND ', $wherestr);	//条件汇总
	
	//获取当前页码
	$total=$gb->getcount($wheresql); 							  //总信息数
	//$pagesize=15;												  //一页显示信息数
	//$page = isset($page) ? max(1, intval($page)) : 1;             //处理页码变量
	//$offset=($page-1)*$pagesize;   								  //偏移量
	$dataarray=$gb->getdata("",$wheresql); //获取团购数据
	
	//包含后台模板文件
	include("tpl/groupbond_listprint.htm");
}elseif($action=="downxls"){

	InitGP(array("gid","sn","uid")); //初始化变量全局返回
	if(!empty($gid))$wherestr[]="gid='{$gid}'";
	if(!empty($sn))$wherestr[]="sn like '%{$sn}%'";
	if(!empty($uid))$wherestr[]="uid={$uid}";
	if(!empty($wherestr)) $wheresql = implode(' AND ', $wherestr);	//条件汇总
	
	//获取当前页码
	$total=$gb->getcount($wheresql); 							  //总信息数
	//$pagesize=15;												  //一页显示信息数
	//$page = isset($page) ? max(1, intval($page)) : 1;             //处理页码变量
	//$offset=($page-1)*$pagesize;   								  //偏移量
	$dataarray=$gb->getdata("",$wheresql); //获取团购数据
	
	$keynames=array(
	"sn"=>"序列号",
	"password"=>"密码",
	"endtime"=>"劵有效期",
	"usetime"=>"劵使用时间"
	);
	
	down_xls($dataarray, $keynames, $name='dataxls');
}

?>

